<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <% response.setCharacterEncoding("UTF-8"); %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/bigjo/js/jquery.js"></script>
<script type="text/javascript" src="/bigjo/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/bigjo/js/json2.js"></script>
<style type="text/css">
	#mInsert{
		text-align:center;
		margin-top: 50px;
	}
</style>
<script type="text/javascript">
	jQuery.noConflict();
	jQuery("#mInsertsub").click(function(){
		var idx = document.URL.indexOf("bigjo");
		var str = document.URL.substring(0, idx+5);
		
		var m_id = jQuery("#m_id").val();
		var m_pw = jQuery("#m_pw").val();
		var m_nickname = jQuery("#m_nickname").val();
		var m_email = jQuery("#m_email").val();
		var m_ssn1 = jQuery("#m_ssn1").val();
		var m_ssn2 = jQuery("#m_ssn2").val();
		var m_addres = jQuery("#m_addres").val();
		if(m_id == null || m_id == ""){
			alert("아이디를 입력하세요");
			return;
		}
		if(m_pw == null || m_pw == ""){
			alert("패스워드를 입력하세요");
			return;
		}
		if(m_nickname == null || m_nickname == ""){
			alert("닉네임을 입력하세요");
			return;
		}
		if(m_email == null || m_email == ""){
			alert("이메일을 입력하세요");
			return;
		}
		if(m_ssn1 == null || m_ssn1 == ""){
			alert("주민번호 앞자리를 입력하세요");
			return;
		}
		if(m_ssn2 == null || m_ssn2 == ""){
			alert("주민번호 뒷자리를 입력하세요");
			return;
		}
		if(m_addres == null || m_addres == ""){
			alert("주소를 입력하세요");
			return;
		}
		

		location.href = str + "/memberInsert.mb?m_id="+m_id+"&m_pw="+m_pw+"&m_nickname="+m_nickname+"&m_email="+m_email+"&m_ssn1="+m_ssn1+"&m_ssn2="+m_ssn2+"&m_addres="+m_addres;

	}); 
	
	/* 	jQuery.noConflict();
	var idx = document.URL.indexOf("/jsp");
	var str = document.URL.substring(0, idx);
	
	jQuery("#mInsert").ajaxForm({
		url : str + "/memberInsert.mb",
		type : "post",
		dataType : "json",
		beforeSend : function() {
			alert("로그인 중!!");
		},
		success : function(data){
			alert("회원가입 성공!!");
		},
		error : function(data){
			alert("회원 가입 실패!!");
			alert(data);
		}
	}); */
	jQuery.noConflict();
	jQuery("#mInsertcancel").click(function(){
		var idx = document.URL.indexOf("bigjo");
		var str = document.URL.substring(0, idx+5);
		location.href= str+ "/home.main";
	});
	
	jQuery.noConflict();
	jQuery("#m_idCheck").click(function(){
		var idx = document.URL.indexOf("bigjo");
		var str = document.URL.substring(0, idx+5);
		var m_id = jQuery("#m_id").val();
		if(m_id == ""){
			alert('아이디를 우선 입력하세요.');
			jQuery("#m_id").val("");
			jQuery("#m_id").focus();
			return ;
		}else if( m_id.length <= 3 ){
			alert('아이디는 4자리 이상입니다.');
			jQuery("#m_id").focus();
			return ;
		}else{
			jQuery.ajax({
				url : str+"/memberidCheck.mb?m_id="+m_id,
				contentType : "application/x-www-form-urlencoded; charset=UTF-8",

				success : function(data) {
					jQuery("#idresult").html(data);
				},
				error: function(request,status,error){
				alert("code : " + request.status + "\n" + "error : " + error );
				}
			});
		}
	});
	jQuery.noConflict();
	jQuery("#m_nicknameCheck").click(function(){
		var idx = document.URL.indexOf("bigjo");
		var str = document.URL.substring(0, idx+5);
		var nickname = jQuery("#m_nickname").val();
		if(nickname == ""){
			alert('닉네임을 우선 입력하세요.');
			jQuery("#m_nickname").val("");
			jQuery("#m_nickname").focus();
			return ;
		}else if(nickname.length <= 3 ){
			alert('아이디는 4자리 이상입니다.');
			jQuery("#m_nickname").focus();
			return ;
		}else{
			jQuery.ajax({
				url : str+"/membernicknameCheck.mb?m_nickname="+nickname,
				contentType : "application/x-www-form-urlencoded; charset=UTF-8",

				success : function(data) {	
					jQuery("#nickresult").html(data);
				},
				error: function(request,status,error){
				alert("code : " + request.status + "\n" + "error : " + error );
				}
				
			});
		}
	});
	jQuery.noConflict();
	jQuery("#m_emailCheck").click(function(){
		var idx = document.URL.indexOf("bigjo");
		var str = document.URL.substring(0, idx+5);
		var email = jQuery("#m_email").val();
		if(email == ""){
			alert('닉네임을 우선 입력하세요.');
			jQuery("#m_email").val("");
			jQuery("#m_email").focus();
			return ;
		}else{
			jQuery.ajax({
				url : str+"/memberemailCheck.mb?m_email="+email,
				contentType : "application/x-www-form-urlencoded; charset=UTF-8",

				success : function(data) {
					jQuery("#emailresult").html(data);
				},
				error: function(request,status,error){
				alert("code : " + request.status + "\n" + "error : " + error );
				}
				
			});
		}
		
	});

	
</script>
</head>
<body>
<jsp:include page="/upMenu.main"></jsp:include>
	<section id="mInsertSection">
		<article id="mInsert">
		<table align="center">
				<tr><td align="right">아이디</td><td align="left"><input type="text" id="m_id" name="m_id" value=""></td><td align="left"><input type="button" id="m_idCheck" value="아이디체크"></td></tr>
				<tr><td></td><td ><span id="idresult"></span></td></tr>
				<tr><td align="right">패스워드</td><td align="left"><input type="password" id="m_pw" name="m_pw" value=""></td></tr>
				<tr><td align="right">닉네임 </td><td align="left"><input type="text" id="m_nickname" name="m_nickname" value=""></td><td><input type="button" id="m_nicknameCheck" value="닉네임체크"></td></tr>
				<tr><td></td><td ><span id="nickresult"></span></td></tr>
				<tr><td align="right">이메일</td><td align="left"><input type="text" id="m_email" name="m_email" value=""></td><td><input type="button" id="m_emailCheck" value="이메일체크"></td></tr>
				<tr><td></td><td ><span id="emailresult"></span></td></tr>
				<tr><td align="right">주민등록 번호</td><td align="left"><input type="text" id="m_ssn1" name="m_ssn1"  maxlength="6" size="6" value="">-<input type="password" id="m_ssn2" maxlength="7" size="7" name="m_ssn2" value=""></td></tr>
				<tr><td align="right">주소</td>
					<td align="left"> 
						<select id="m_addres" name="m_addres">
							<option>서울특별시</option>
							<option>광주특별시</option>
							<option>대구특별시</option>
							<option>대전특별시</option>
							<option>울산특별시</option>
							<option>강원도</option>
							<option>경기도</option>
							<option>경상도</option>
							<option>전라도</option>
							<option>충청도</option>
							<option>세종틀별자치시</option>
							<option>제주도특별자치도</option>
							<option>충청도</option>
						</select>
					</td></tr>
				<!-- <input type="text" id="m_addres" name="m_addres" value="Seoul"> -->
		</table>
				<input type="button" id="mInsertsub" name="mInsertsub" value="등록">
				<input type="button" id="mInsertcancel" name="mInsertcancel" value="취소">
		</article>
	</section>
</body>
</html>